import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CourseCertificateVO, CourseCertificateForm, CourseCertificateQuery } from '@/api/core/courseCertificate/types';

/**
 * 查询实验课程开课凭证列表
 * @param query
 * @returns {*}
 */

export const listCourseCertificate = (query?: CourseCertificateQuery): AxiosPromise<CourseCertificateVO[]> => {
  return request({
    url: '/core/courseCertificate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询实验课程开课凭证详细
 * @param id
 */
export const getCourseCertificate = (id: string | number): AxiosPromise<CourseCertificateVO> => {
  return request({
    url: '/core/courseCertificate/' + id,
    method: 'get'
  });
};

/**
 * 新增实验课程开课凭证
 * @param data
 */
export const addCourseCertificate = (data: CourseCertificateForm) => {
  return request({
    url: '/core/courseCertificate',
    method: 'post',
    data: data
  });
};

/**
 * 修改实验课程开课凭证
 * @param data
 */
export const updateCourseCertificate = (data: CourseCertificateForm) => {
  return request({
    url: '/core/courseCertificate',
    method: 'put',
    data: data
  });
};

/**
 * 删除实验课程开课凭证
 * @param id
 */
export const delCourseCertificate = (id: string | number | Array<string | number>) => {
  return request({
    url: '/core/courseCertificate/' + id,
    method: 'delete'
  });
};
